package com.designlollipopdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

public class Actvity_CollapsingToolbarLayout extends AppCompatActivity {

    //下拉  有背景图
   Toolbar toolbar;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_actvity__collapsing_toolbar_layout);
       toolbar= (Toolbar) findViewById(R.id.toolbar);
        toolbar.setNavigationIcon(R.mipmap.icon_back);
        toolbar.setTitle("标题");

//        toolbar.setLogo(R.mipmap.ic_launcher);
//
//        toolbar.setTitle("主标题");
//        toolbar.setSubtitle("副标题");
//       //设置后  会在 右侧
//        toolbar.inflateMenu(R.menu.menu_main);
//        toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
//            @Override
//            public boolean onMenuItemClick(MenuItem item) {
//                String msg = "";
//                switch (item.getItemId()) {
//                    case R.id.action_edit:
//                        msg += "Click edit";
//                        break;
////                    case R.id.action_share:
////                        msg += "Click share";
////                        break;
////                    case R.id.action_settings:
////                        msg += "Click setting";
////                        break;
//                }
//
//                if(!msg.equals("")) {
//                    Toast.makeText(Actvity_CollapsingToolbarLayout.this, msg, Toast.LENGTH_SHORT).show();
//                }
//                return true;
//            }
//        });
    }
}
